<?php

//Tao Lop DOI_TUONG
class Donvitinh {

    private $_DVT_ID;
    private $_DVT_DVT;
    private $_IS_ACTIVE;

    public function getDVT_ID() {
        return $this->_DVT_ID;
    }

    public function getDVT_DVT() {
        return $this->_DVT_DVT;
    }

    public function getIS_ACTIVE() {
        return $this->_IS_ACTIVE;
    }

    public function setDVT_ID($DVT_ID) {
        $this->_DVT_ID = $DVT_ID;
    }

    public function setDVT_DVT($DVT_DVT) {
        $this->_DVT_DVT = $DVT_DVT;
    }

    public function setIS_ACTIVE($IS_ACTIVE) {
        $this->_IS_ACTIVE = $IS_ACTIVE;
    }

        public function SetDonvitinh($row) {
        $this->setDVT_ID($row->DVT_ID);
        $this->setDVT_DVT($row->DVT_DVT);
        $this->setIS_ACTIVE($row->IS_ACTIVE);
    }



    public function getList($db = null) {
        if ($db != null) {
            $sql = "SELECT
                         `DVT_ID`,
                         `DVT_DVT`,
                         `IS_ACTIVE`
                  FROM `don_vi_tinh`";
            $rows = $db->executeQuery($sql);
            $objects = array();
            if ($rows != null) {
                while ($row = $rows->fetch()) {
                    $donvitinh = new Donvitinh();
                    $donvitinh->setDVT_ID($row->DVT_ID);
                    $donvitinh->setDVT_DVT($row->DVT_DVT);
                    $donvitinh->setIS_ACTIVE($row->IS_ACTIVE);

                    $objects[] = $donvitinh;
                }
                return $objects;
            }
        }
    }

}
